Sufficiency
For every plant, its forecast and IBP forecast are summed for the given number of months and compared to the total inventory.
Sufficiency is thus checked both according to my forecast and IBP forecast.
df = pd.read_parquet(f"./data/{country}/forecast.parquet")
inv = pd.read_csv(f"./data/{country}/inventory.csv")
inv = inv.groupby("brand")["inventory"].sum().reset_index()
inv["inventory"] /= 1000
starting_date = date.today().replace(day=1)
ending_date = starting_date + relativedelta(months=month-1)
new = df[(df.date >= datetime.strftime(starting_date, "%Y-%m-%d")) & (df.date <= datetime.strftime(ending_date, "%Y-%m-%d"))]
new = new.groupby("brand")[["Forecast", "IBP"]].sum().reset_index().merge(inv, on="brand")
new["our_sufficiency"] = new["inventory"] - new["Forecast"]
new["IBP_sufficiency"] = new["inventory"] - new["IBP"]
Only a few products have different sufficiency (true or false) for my forecast and IBP forecast. These are the interesting brands.